home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / boundaryToolScript.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.7 KB  |  164 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. // Alias|Wavefront Script File
  19. // MODIFY THIS AT YOUR OWN RISK
  20. //
  21. // Creation Date:  14 January 1999
  22. // Author:         sw
  23. //
  24. //
  25. //  Procedure Name:
  26. //      boundaryToolScript
  27. //
  28. //  Description:
  29. //    create wrapper around the boundary command
  30. //
  31. //  Input Arguments:
  32. //        0 ==> do the command.
  33. //        1 ==> show the action option box
  34. //        2 ==> return the command
  35. //        3 ==> show tool option box
  36. //        4 ==> enter the tool
  37. //
  38. //  Return Value:
  39. //      None.
  40. //
  41.  
  42. global proc boundary4curves( int $ncurves, string $goToTool )
  43. {
  44.     scriptCtx -e -ssc $ncurves $goToTool;
  45.     if( 4 == $ncurves ) {
  46.         scriptCtx -e
  47.           -setNoSelectionPrompt ("Select 4 curve(s), isoparm(s) " +
  48.                                  "or trim edges forming a " +
  49.                                  "closed region).")
  50.           -setSelectionPrompt ("Select 4 curves, isoparms or trim " +
  51.                                "edges forming a closed region; " +
  52.                                "press ENTER to compute boundary surface.")
  53.           $goToTool;
  54.     }
  55.     else if( 3 == $ncurves ) {
  56.         scriptCtx -e
  57.           -setNoSelectionPrompt ("Select 3 curve(s), isoparm(s) " +
  58.                                  "or trim edges forming a " +
  59.                                  "closed region).")
  60.           -setSelectionPrompt ("Select 3 curves, isoparms or trim " +
  61.                                "edges forming a closed region; " +
  62.                                "press ENTER to compute boundary surface.")
  63.           $goToTool;
  64.     }
  65.     else {
  66.         scriptCtx -e
  67.           -setNoSelectionPrompt ("Select 3 or 4 curve(s), isoparm(s) " +
  68.                                  "or trim edges forming a " +
  69.                                  "closed region).")
  70.           -setSelectionPrompt ("Select 3 or 4 curves, isoparms or trim " +
  71.                                "edges forming a closed region; " +
  72.                                "press ENTER to compute boundary surface.")
  73.           $goToTool;
  74.     }
  75. }
  76.  
  77. global proc boundaryToolSetup( int $forceFactorySettings, string $goToTool )
  78. {
  79.     if( $forceFactorySettings || !`optionVar -ex boundaryEuc` ) {
  80.         optionVar -iv boundaryEuc 0;
  81.     }
  82.     if( $forceFactorySettings || !`optionVar -ex boundaryLac` ) {
  83.         optionVar -iv boundaryLac 1;
  84.     }
  85.     if( "" != $goToTool ) {
  86.         scriptCtx -e -euc `optionVar -q boundaryEuc` $goToTool;
  87.         scriptCtx -e -lac `optionVar -q boundaryLac` $goToTool;
  88.         boundary4curves 0 $goToTool;
  89.     }
  90. }
  91.  
  92. global proc boundaryValues ( string $toolName ) 
  93. {
  94.     performBoundary 3 $toolName;
  95.     scriptCtxCommonValues( $toolName );
  96. }
  97.  
  98. global proc boundaryProperties()
  99. {
  100.     scriptCtxCommonProperties;
  101. }
  102.  
  103. global proc boundaryAutoComplete( int $val, string $goToTool )
  104. {
  105.     scriptCtx -e -lac $val $goToTool;
  106.     boundary4curves `optionVar -q boundaryAutoEdgeCount` $goToTool;
  107. }
  108.  
  109. proc createBoundaryContext( string $tool )
  110. {
  111.     if( ! `scriptCtx -exists $tool` ) {
  112.         boundaryToolSetup( 0, "" );
  113.         scriptCtx -i1 "boundary.xpm"
  114.           -title "Boundary Tool"
  115.           -bcn "boundary"
  116.  
  117.           -exitUponCompletion `optionVar -q boundaryEuc`
  118.           -totalSelectionSets 1
  119.           -expandSelectionList true
  120.           -fcs ("boundaryToolScript 0")
  121.  
  122.           -setNoSelectionPrompt ("Select 3 or 4 curve(s), isoparm(s) " +
  123.                                  "or trim edges forming a " +
  124.                                  "closed region).")
  125.           -setSelectionPrompt ("Select 3 or 4 curves, isoparms or trim " +
  126.                                "edges forming a closed region; " +
  127.                                "press ENTER to compute boundary surface.")
  128.  
  129.           -setAutoToggleSelection true
  130.           -setAutoComplete `optionVar -q boundaryLac`
  131.           -showManipulators true
  132.  
  133.           -setSelectionCount 0
  134.           -nurbsCurve true
  135.           -isoparm true
  136.           -curveOnSurface true
  137.           -surfaceEdge true
  138.           -polymeshEdge true
  139.         $tool;
  140.     }
  141. }
  142.  
  143. global proc string boundaryToolScript( int $setToTool )
  144. //
  145. //    Description :
  146. //        0 ==> do the command.
  147. //        1 ==> show the action option box
  148. //        2 ==> return the command
  149. //        3 ==> show tool/action option box
  150. //        4 ==> enter the tool/do the command
  151. {
  152.     string $tool = "";
  153.     if( $setToTool > 2 ) {
  154.         if( !`optionVar -q modelWithToolBoundary` ) {
  155.             $setToTool = 4 - $setToTool;
  156.         }
  157.         else {
  158.             $tool = "boundaryContext";
  159.             createBoundaryContext $tool;
  160.         }
  161.     }
  162.     return scriptToolScript( "performBoundary", $setToTool, $tool );
  163. }
  164.